<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{$title}——地宝网任务系统</title>
<meta name="description" content="Administry - Admin Template by Zoran Juric" />
<meta name="keywords" content="Admin,Template" />
<meta name="author" content="zhongmingzi@gmail~power by favlab.com" />
{csstemplate}
{jstemplate}
<script type="text/javascript" src="static/js/jquery.administry.js"></script>
<script type="text/javascript">
var API = "{URL}ajax_api.php", URL = "{URL}", uid = {$_G[uid]}, username = "{$_G[username]}";
$(function() {
	Administry.setup();
});
function  checkall(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		e.checked == true ? e.checked = false : e.checked = true;
	}
}
//全选返回数组的值
function getarrvalue(name) {
	var boxs = document.getElementsByName(name); 
	var arrs = [];
	for(var i = 0; i < boxs.length; i++){
		if(boxs[i].checked == true)
		arrs.push(boxs[i].value); 
	}
	return arrs;
}
$(document).ready(function(){
<!--{if CURMODULE == 'index'}-->
	var validator = $("#loginform").validate({
		rules: {
			username: "required",
			password: "required"
		},
		messages: {
			username: "请输入你的用户名！",
			password: "请输入您的密码！"
		},
		errorPlacement: function(error, element) {
			error.insertAfter(element.parent().find('label:first'));
		},
		success: function(label) {
			label.html("&nbsp;").addClass("ok");
		}
	});
<!--{elseif CURMODULE == 'cp' && !$do}-->
	Administry.progress("#progress1", 1, 5);
	Administry.progress("#progress2", 2, 5);
	Administry.progress("#progress3", 2, 5);
<!--{elseif CURMODULE == 'cp' && $do == 'tasklist'}-->
	$("#tabs").tabs();
<!--{elseif CURMODULE == 'admin'}-->
<!--{/if}-->
//全选
$("#checkall").toggle(
   function () {
	 $("input:checkbox").attr("checked",true);
   },
   function () {
	 $("input:checkbox").attr("checked", false);
   }
);
//审核通过
$(".cok").click(function(){
	$.post(API,{action:'okuser',id:$(this).attr('id').substr(2)},function(data) {$('#co' + data).replaceWith("<img src='template/default/images/accept.png' />");});
});
//删除用户
$(".cdel").click(function(){
	$.post(API,{action:'deluser',id:$(this).attr('id').substr(2)},function(data) {$('#tr' + data).remove();});
});
//全部审核通过
$(".caok").click(function(){
	var selarr = getarrvalue("selectedid");
	if(selarr.length == 0) { alert('您的选择为空！');return false; }
	$.post(API,{action:'okuser',id:selarr},function(data) {window.location.reload();});
});
//删除全部用户
$(".cadel").click(function(){
	var selarr = getarrvalue("selectedid");
	if(selarr.length == 0) { alert('您的选择为空！');return false; }
	$.post(API,{action:'deluser',id:selarr},function(data) {window.location.reload();});
});
//审核任务通过
$(".lok").click(function(){
	$.post(API,{action:'oktask',lid:$(this).attr('id').substr(2)},function(data) {$('#co' + data).replaceWith("<img src='template/default/images/accept.png' />");});
});
//审核任务不通过
$(".ldel").click(function(){
	$.post(API,{action:'nottask',lid:$(this).attr('id').substr(2)},function(data) {$('#cd' + data).replaceWith("<img src='template/default/images/cancel.png' />");});
});
//任务全部审核通过
$(".laok").click(function(){
	var selarr = getarrvalue("selectedid");
	if(selarr.length == 0) { alert('您的选择为空！');return false; }
	$.post(API,{action:'oktask',lid:selarr},function(data) {window.location.reload();});
});
//不通过全部任务
$(".ladel").click(function(){
	var selarr = getarrvalue("selectedid");
	if(selarr.length == 0) { alert('您的选择为空！');return false; }
	$.post(API,{action:'nottask',lid:selarr},function(data) {window.location.reload();});
});
//提交报名信息
$(".apt").click(function(){
	$.post(API,{action:'applytask',id:$(this).attr('id').substr(4),type:$(this).attr('alt')},function(data) {
		if(data.substr(0, 4) == 'over') $('#task' + data.substr(4)).replaceWith("<font color='red'>名额已满</font>");
		else if(data != '' && data.substr(0, 4) != 'over') $('#task' + data).replaceWith("<font color='red'>已报名</font>");
	
	});
});
//删除任务
$(".det").click(function(){
	$.post(API,{action:'deltask',id:$(this).attr('id').substr(2),type:$(this).attr('alt')},function(data) {$('#tlk' + data).remove();});
});
//append操作
$("#addappbtn").live('click', function(){
	$("#appendp").append("<input type=\"text\" id=\"detail\" class=\"half\" value=\"\" name=\"detail[]\"/>");
});
//删除某个主题任务
$(".ttdel").live('click', function(){
	$.post(API,{action:'delthreadtask',uid:uid,id:$(this).attr('id').substr(2)},function(data) {$('#tr' + data).remove();});
});
//删除全部提交主题任务
$(".catdel").live('click', function(){
	var selarr = getarrvalue("selectedtid");
	if(selarr.length == 0) { alert('您的选择为空！');return false; }
	$.post(API,{action:'delthreadtask',uid:uid,id:selarr},function(data) {window.location.reload();});
});
//解除绑定
$(".bddel").click(function(){
	$.post(API,{action:'delbd',id:$(this).attr('id').substr(2)},function(data) {$('#tr' + data).remove();});
});
//回复贴通过
$(".postok").live('click', function(){
	$.post(API,{action:'okpost',taskid:$(this).attr('alt').substr(2),uid:$(this).attr('id').substr(4)},function(data) {$('#user' + data).replaceWith("<img src='template/default/images/accept.png' />");});
});
});
</script>
</head>
<body id="{CURSCRIPT}" class="{CURMODULE}">
	<header id="top">
		<div class="wrapper">
			<div id="title"><img SRC="template/default/images/logo.png" alt="Administry" /></div>
			<!--{if (CURMODULE == 'cp' || CURMODULE == 'admin') && $_G[uid]}-->
			<div id="topnav">
				登录名： <b>{$_G['username']}</b>
				<span>|</span> <a href="?mod=cp&do=myinfo">设置</a>
				<span>|</span> <a href="?mod=cp&do=logout&formhash={FORMHASH}">安全退出</a><br />
				<!--<small>You have <a href="#" class="high"><b>1</b> new message!</a></small>-->
			</div>
			<!--{/if}-->
			<nav id="menu">
				<ul class="sf-menu">
					<!--{if CURMODULE == 'index'}-->
						<li {if $do=='login'}class="current"{/if}><a href="?do=login">登陆</a></li>
						<li {if $do=='register'}class="current"{/if}><a href="?do=register">注册</a></li>
					<!--{elseif CURMODULE == 'cp' || CURMODULE == 'admin'}-->
						<li {if $do==''}class="current"{/if}><a HREF="?mod=cp">公告板</a></li>
						<li><a HREF="?mod=cp&do=tasklist">任务列表</a></li>
						<li><a HREF="?mod=cp&do=myinfo">个人信息</a>
							<ul>
								<li>
									<a HREF="?mod=cp&do=binding">地宝账号绑定</a>
								</li>
								<li>
									<a HREF="?mod=cp&do=myinfo">个人信息修改</a>
								</li>
								<li>
									<a HREF="?mod=cp&do=mythreadtask">我领取的主题帖任务</a>
								</li>
								<li>
									<a HREF="?mod=cp&do=myposttask">我领取的回复贴任务</a>
								</li>
								<li>
									<a href="?mod=cp&do=myext">我的积分列表</a>
								</li>
							</ul>
						</li>	
						<li {if $mod=='admin'}class="current"{/if}><a HREF="?mod=admin">管理操作</a>
							<ul>
								<li>
									<a HREF="?mod=admin&do=verifyuser">审核注册用户</a>
								</li>
								<li>
									<a HREF="?mod=admin&do=newtask">发布新任务</a>
								</li>
								<li>
									<a HREF="?mod=admin&do=verifytask">审核主题帖任务列表</a>
								</li>
								<li>
									<a HREF="?mod=admin&do=verifyposttask">审核回复贴任务列表</a>
								</li>
							</ul>
						</li>	
					<!--{/if}-->
				</ul>
			</nav>
			<aside><b>欢迎来到地宝网任务系统！</b></aside>
		</div>
	</header>
	<div id="pagetitle">
		<div class="wrapper">
		<!--{if CURMODULE == 'cp' || CURMODULE == 'admin'}--><h1>管理面板</h1><!--{/if}-->
		</div>
		<!--{if CURMODULE == 'cp' || CURMODULE == 'admin'}-->
			<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
		<!--{/if}-->
	</div>
	<div id="page">